package org.xhy.hrm.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * Document创建文档
 *  indexName 索引库
 *  type 类型（表）
 */
@Document(indexName = "hrm",type = "course")
@Data
public class CourseDoc {

    /**
     * @id Document文档id和对象id
     */
    @Id
    private Long id;

    /**
     * FieldType.Text 分词
     * analyzer 分词器
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    /**
     * 等级 FieldType.Keyword 不分词
     *  index = true 创建索引 默认开启
     */
    @Field(index = true,type = FieldType.Keyword)
    private String gradeName;

    @Field(index = true,type = FieldType.Keyword)
    private String forUser;

    @Field(index = true,type = FieldType.Long)
    private Long courseTypeId;

    @Field(index = true,type = FieldType.Keyword)
    private String tenantName;

    @Field(index = false,type = FieldType.Keyword)
    private String pic;

    @Field(index = false,type = FieldType.Integer)
    private Integer saleCount;

    @Field(index = false,type = FieldType.Integer)
    private Integer viewCount;

    @Field(index = false,type = FieldType.Integer)
    private Integer commentCount;

    @Field(index = true,type = FieldType.Keyword)
    private String charge;

    @Field(index = true,type = FieldType.Float)
    private Float price;

    @Field(index = true,type = FieldType.Float)
    private Float priceOld;

    @Field(index = false,type = FieldType.Date)
    private Date onlineTime;

}
